package com.mdb.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;

public class ByteBuffTest {
	public static void main(String[] args) {
		try {
			FileChannel channel = new FileInputStream("D:/天珠/战斗力评定.txt").getChannel();
			FileChannel outPut = new FileOutputStream("D:/copy.txt").getChannel();
			ByteBuffer bb = ByteBuffer.allocate(10);
			try {
				while(true) {
					bb.clear();
					int i = channel.read(bb);
					if(i == -1) 
						break;
					bb.flip();
					outPut.write(bb);
				}
				
			} catch (IOException e) {
				e.printStackTrace();
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
	}
}
